<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增考勤组')" />
    <th:block th:include="include :: bootstrap-duallistbox-css" />
    <th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-group-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">考勤组名称：</label>
                <div class="col-sm-8">
                    <input name="groupName" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">考勤规则(可多选)：</label>
                <div class="col-sm-8">
                    <select class="form-control noselect2 selectpicker" name="ruleId" th:with="rule=${@attendanceRule.getRuleList()}" data-none-selected-text="请选择考勤规则" multiple>
                        <option th:each="rule : ${rule}" th:text="${rule.name}" th:value="${rule.id}"></option>
                    </select>
                </div>

            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control" ></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: bootstrap-duallistbox-js" />
    <th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-select-js" />
    <script type="text/javascript">
        var prefix = ctx + "school/attendance/group"
        $("#form-group-add").validate({
            focusCleanup: true
        });

        $('.dual_select').bootstrapDualListbox({
            nonSelectedListLabel: '未添加',
            selectedListLabel: '已添加',
            preserveSelectionOnMove: 'moved',
            moveOnSelect: false,           // 出现一个剪头，表示可以一次选择一个
            filterTextClear: '展示所有',
            moveSelectedLabel: "添加",
            moveAllLabel: '添加所有',
            removeSelectedLabel: "移除",
            removeAllLabel: '移除所有',
            infoText: '',
            infoTextEmpty: '',
            showFilterInputs: false,       // 是否带搜索
            selectorMinimalHeight: 140
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-group-add').serialize());
            }
        }
    </script>
</body>
</html>